package com.sxdx.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringTokenizer;

/**
 * @Classname TimeUtil
 * @Description TODO
 * @Version 1.0.0
 * @Date 2023/12/22 14:14
 * @Created by m元波
 */
public class TimeUtil {


    public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

    public static String getDateTime() {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
        Date currentTime = new Date();
        String strDate = formatter.format(currentTime);
        StringTokenizer token = new StringTokenizer(strDate, "-");
        String year = token.nextToken();
        String month = token.nextToken();
        String day = token.nextToken();
        String hh = token.nextToken();
        String mm = token.nextToken();
        String ss = token.nextToken();
        String strServerDateTime = "";
        strServerDateTime = year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
        return strServerDateTime;
    }

}

